
<template src="./tpl.html">


        
</template>

<script>
import { CONSENT_GET_HYX_TJYY} from "_SERVICES/api";
import { trimAll } from "UTILS/string";
import { isvalidateNum2 } from "UTILS/validate";
import { timeFormatter } from "UTILS/format";



import page from "@/modules/CST/mxins/page";
export default {
  name: "hyx_list",
  mixins: [page],
  data() {
    return {
      pickerOptions: {
        shortcuts: [{
          text: '最近一周',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近三个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            picker.$emit('pick', [start, end]);
          }
        }]
      },
      formInline: {
        YYSJ:[timeFormatter(new Date(),2),timeFormatter(new Date(),2)],
        ZYH:"",
        BRBH:"",
        BRXM:"",
        TJBH:""
      },
      card_obj:{},
    
      headers: [
        {
          label: "就诊卡号",
          prop: "BRBH",
        },
        {
          label: "住院号",
          prop: "ZYH",
        },
        {
          label: "体检编号",
          prop: "TJBH",
        },
        {
          label: "患者姓名",
          prop: "BRXM",
        },
        {
          label: "性别",
          prop: "BRXB_STR",
          width:60
        },
        {
          label: "检查号",
          prop: "JCH",
        },
        {
          label: "检查项目",
          prop: "JCBW",
        },
        {
          label: "开单科室",
          prop: "SQZKMC",
        },
        {
          label: "联系方式",
          prop: "LXDH",
        },
        {
          label: "状态",
          prop: "ZTBZ_STR",
        },
      ],
    };
  },
  created() {
    this.getList();
    
  },
  mounted() {},
  methods: {
    resetForm(name) {
      this.$refs[name].resetFields();
      this.$refs.ybCard.clear();
      this.card_obj = {}
      // this.search();
    },
   
    getList() {

      this.listLoading = false;
      let params = {
        ...this.formInline,
        BSLX: this.card_obj.BSLX || "",//BSLX
        WYBS: this.card_obj.WYBS || "",//WYBS
      };
      Object.assign(params, this.getParams());

      return CONSENT_GET_HYX_TJYY(params)
        .then((res) => {
          this.listLoading = false;
          this.listQuery.totalNum = res.data.totalNum;
          this.tableData = res.data.list;
          this.CONSENT_GET_CURRENT_VERSION();//检查版本
        })
        .catch((res) => {
          this.listLoading = false;
          this.downloadLoading = false;
      });
    },
    //刷卡只受预约时间的约束
    back(obj){
      if(obj.code==0){
        this.card_obj = obj;
        this.search();
      }else{
        this.card_obj = {}
        if(obj.msg) {
          this.$message.error(obj.msg)
        }
      }
     
    },
    rowClick(row){
      console.log(row)
      // this.$router.push({
      //   path:"/consentList",
      //   query:{
      //     fromPage:"PATIENT_LIST",
      //     BRBH: row.BRBH,
      //     GET_PATIENT_BY_PRIMARY: row.JCH,
      //     GET_PATIENT_TYPE:"HYXZX",
      //   }
       
      // })


      let baseUrl = `http://localhost:9527/CST.html#/consentList?`;
      if (process.env.VUE_APP_build_type == 'production') {
        baseUrl = `http://10.1.6.124:99/CST.html#/consentList?`;
      }
      baseUrl += `fromPage=PATIENT_LIST&BRBH=${row.BRBH}&BRXM=${row.BRXM}&GET_PATIENT_BY_PRIMARY=${row.JCH}&GET_PATIENT_TYPE=HYXZX`
      window.open(baseUrl, '_blank');



    }
  },
};
</script>

<style lang="less">

</style>
